package com.sgb.member.weight.threefliter;

import com.contrarywind.interfaces.IPickerViewData;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.Objects;

public class MPickFilterEntity<T> implements Serializable, IPickerViewData {

    private String no;

    @SerializedName(value = "name", alternate = {"simpleName"})
    private String name;

    private int num;//个人中心 数量统计新加

    private String id;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public MPickFilterEntity(String no, String name, int num) {
        this.no = no;
        this.name = name;
        this.num = num;
    }

    public MPickFilterEntity() {

    }
    public MPickFilterEntity(String no, String name) {
        this.no = no;
        this.name = name;
    }

    public MPickFilterEntity(String no, String name, T children) {
        this.no = no;
        this.name = name;
        this.children = children;
    }

    private T children;

    //非服务器字段， 用于保存item的状态
    private boolean isChoose;

    public boolean isChoose() {
        return isChoose;
    }

    public void setChoose(boolean choose) {
        isChoose = choose;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public T getChildren() {
        return children;
    }

    public void setChildren(T children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "PickFilterEntity{" +
                "no='" + no + '\'' +
                ", name='" + name + '\'' +
                ", children=" + children +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        MPickFilterEntity<?> that = (MPickFilterEntity<?>) o;
        return Objects.equals(no, that.no) &&
                Objects.equals(name, that.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(no, name);
    }

    @Override
    public String getPickerViewText() {
        return name;
    }
}
